﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Admin-One-Column.master" AutoEventWireup="true" CodeBehind="Sach.aspx.cs" Inherits="BookStore.admin.Sach" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BreadcrumbsContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainColumnContent" runat="server">
<div id="admin-table">
    <asp:SqlDataSource ID="SachFVDS" runat="server" 
        ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:BookStoreConnectionString %>" 
        DeleteCommand="DELETE FROM [Sach] WHERE [MaSach] = @original_MaSach AND [MaLoaiSach] = @original_MaLoaiSach AND [MaNXB] = @original_MaNXB AND [TenSach] = @original_TenSach AND [NgayXuatBan] = @original_NgayXuatBan AND (([Mota] = @original_Mota) OR ([Mota] IS NULL AND @original_Mota IS NULL)) AND (([SoLuong] = @original_SoLuong) OR ([SoLuong] IS NULL AND @original_SoLuong IS NULL)) AND (([DonGia] = @original_DonGia) OR ([DonGia] IS NULL AND @original_DonGia IS NULL)) AND (([ImageURL] = @original_ImageURL) OR ([ImageURL] IS NULL AND @original_ImageURL IS NULL)) AND [ChieuCao] = @original_ChieuCao AND [ChieuRong] = @original_ChieuRong AND [BeDay] = @original_BeDay AND [KhoiLuong] = @original_KhoiLuong" 
        InsertCommand="INSERT INTO [Sach] ([MaLoaiSach], [MaNXB], [TenSach], [NgayXuatBan], [Mota], [SoLuong], [DonGia], [ImageURL], [ChieuCao], [ChieuRong], [BeDay], [KhoiLuong]) VALUES (@MaLoaiSach, @MaNXB, @TenSach, @NgayXuatBan, @Mota, @SoLuong, @DonGia, @ImageURL, @ChieuCao, @ChieuRong, @BeDay, @KhoiLuong)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT * FROM [Sach] WHERE ([MaSach] = @MaSach)" 
        UpdateCommand="UPDATE [Sach] SET [MaLoaiSach] = @MaLoaiSach, [MaNXB] = @MaNXB, [TenSach] = @TenSach, [NgayXuatBan] = @NgayXuatBan, [Mota] = @Mota, [SoLuong] = @SoLuong, [DonGia] = @DonGia, [ImageURL] = @ImageURL, [ChieuCao] = @ChieuCao, [ChieuRong] = @ChieuRong, [BeDay] = @BeDay, [KhoiLuong] = @KhoiLuong WHERE [MaSach] = @original_MaSach AND [MaLoaiSach] = @original_MaLoaiSach AND [MaNXB] = @original_MaNXB AND [TenSach] = @original_TenSach AND [NgayXuatBan] = @original_NgayXuatBan AND (([Mota] = @original_Mota) OR ([Mota] IS NULL AND @original_Mota IS NULL)) AND (([SoLuong] = @original_SoLuong) OR ([SoLuong] IS NULL AND @original_SoLuong IS NULL)) AND (([DonGia] = @original_DonGia) OR ([DonGia] IS NULL AND @original_DonGia IS NULL)) AND (([ImageURL] = @original_ImageURL) OR ([ImageURL] IS NULL AND @original_ImageURL IS NULL)) AND [ChieuCao] = @original_ChieuCao AND [ChieuRong] = @original_ChieuRong AND [BeDay] = @original_BeDay AND [KhoiLuong] = @original_KhoiLuong">
        <DeleteParameters>
            <asp:Parameter Name="original_MaSach" Type="Int32" />
            <asp:Parameter Name="original_MaLoaiSach" Type="Int32" />
            <asp:Parameter Name="original_MaNXB" Type="Int32" />
            <asp:Parameter Name="original_TenSach" Type="String" />
            <asp:Parameter Name="original_NgayXuatBan" Type="DateTime" />
            <asp:Parameter Name="original_Mota" Type="String" />
            <asp:Parameter Name="original_SoLuong" Type="Int32" />
            <asp:Parameter Name="original_DonGia" Type="Int32" />
            <asp:Parameter Name="original_ImageURL" Type="String" />
            <asp:Parameter Name="original_ChieuCao" Type="Int32" />
            <asp:Parameter Name="original_ChieuRong" Type="Int32" />
            <asp:Parameter Name="original_BeDay" Type="Int32" />
            <asp:Parameter Name="original_KhoiLuong" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="MaLoaiSach" Type="Int32" />
            <asp:Parameter Name="MaNXB" Type="Int32" />
            <asp:Parameter Name="TenSach" Type="String" />
            <asp:Parameter Name="NgayXuatBan" Type="DateTime" />
            <asp:Parameter Name="Mota" Type="String" />
            <asp:Parameter Name="SoLuong" Type="Int32" />
            <asp:Parameter Name="DonGia" Type="Int32" />
            <asp:Parameter Name="ImageURL" Type="String" />
            <asp:Parameter Name="ChieuCao" Type="Int32" />
            <asp:Parameter Name="ChieuRong" Type="Int32" />
            <asp:Parameter Name="BeDay" Type="Int32" />
            <asp:Parameter Name="KhoiLuong" Type="Int32" />
        </InsertParameters>
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="" Name="MaSach" QueryStringField="id" 
                Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="MaLoaiSach" Type="Int32" />
            <asp:Parameter Name="MaNXB" Type="Int32" />
            <asp:Parameter Name="TenSach" Type="String" />
            <asp:Parameter Name="NgayXuatBan" Type="DateTime" />
            <asp:Parameter Name="Mota" Type="String" />
            <asp:Parameter Name="SoLuong" Type="Int32" />
            <asp:Parameter Name="DonGia" Type="Int32" />
            <asp:Parameter Name="ImageURL" Type="String" />
            <asp:Parameter Name="ChieuCao" Type="Int32" />
            <asp:Parameter Name="ChieuRong" Type="Int32" />
            <asp:Parameter Name="BeDay" Type="Int32" />
            <asp:Parameter Name="KhoiLuong" Type="Int32" />
            <asp:Parameter Name="original_MaSach" Type="Int32" />
            <asp:Parameter Name="original_MaLoaiSach" Type="Int32" />
            <asp:Parameter Name="original_MaNXB" Type="Int32" />
            <asp:Parameter Name="original_TenSach" Type="String" />
            <asp:Parameter Name="original_NgayXuatBan" Type="DateTime" />
            <asp:Parameter Name="original_Mota" Type="String" />
            <asp:Parameter Name="original_SoLuong" Type="Int32" />
            <asp:Parameter Name="original_DonGia" Type="Int32" />
            <asp:Parameter Name="original_ImageURL" Type="String" />
            <asp:Parameter Name="original_ChieuCao" Type="Int32" />
            <asp:Parameter Name="original_ChieuRong" Type="Int32" />
            <asp:Parameter Name="original_BeDay" Type="Int32" />
            <asp:Parameter Name="original_KhoiLuong" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>

    <asp:DetailsView ID="DetailsView1" runat="server"
        DataSourceID="SachFVDS" ForeColor="#333333" GridLines="None" Height="50px" 
        Width="500px" AutoGenerateRows="False">
                <AlternatingRowStyle BackColor="White" />
        <CommandRowStyle BackColor="#C5BBAF" Font-Bold="True" />
        <EditRowStyle BackColor="#7C6F57" />
        <FieldHeaderStyle BackColor="#D0D0D0" Font-Bold="True" />
        <Fields>
            <asp:BoundField DataField="MaSach" HeaderText="Mã sách" />
            <asp:BoundField DataField="MaLoaiSach" HeaderText="Loại sách" />
            <asp:BoundField DataField="MaNXB" HeaderText="Nhà xuất bản" />
            <asp:BoundField DataField="Mota" HeaderText="Mô tả" />
            <asp:BoundField DataField="SoLuong" HeaderText="Số lượng" />
            <asp:BoundField DataField="DonGia" HeaderText="Đơn giá" />
            <asp:BoundField DataField="ImageURL" HeaderText="ImageURL" />
            <asp:BoundField DataField="ChieuCao" HeaderText="Cao" />
            <asp:BoundField DataField="ChieuRong" HeaderText="Rộng" />
            <asp:BoundField DataField="BeDay" HeaderText="Bề dày" />
            <asp:BoundField DataField="KhoiLuong" HeaderText="Khối Lượng" />
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                        CommandName="Update" Text="Update"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                        CommandName="Insert" Text="Insert"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                        CommandName="Edit" Text="Edit"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="New" Text="New"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" 
                        CommandName="Delete" Text="Delete"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Fields>
        <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#E3EAEB" />
    </asp:DetailsView>
    </div>
</asp:Content>
